import React from 'react';
import { Router, Route, IndexRoute } from 'react-router';
import Login from '../containers/Login/login.js';
import TestPackage from '../components/testPackage';
import FormTestPackage from '../components/testPackage/form.js';
import TestCategory from '../components/testCategory';
import ChildrenDevice from '../components/childrenDevice';
import PushCategory from '../components/pushCategory';
import TestResult from '../components/testResult';
import OfficialChannel from '../components/officialChannel';
import FormChannel from '../components/officialChannel/form.js';
import PushChannel from '../components/officialChannel/pushChannel.js';
import OfficialPackage from '../components/officialPackage';
import PushLog from '../components/operatePushLog';
import ChannelLog from '../components/operateChannelLog';
import OtherLog from '../components/operateOtherLog';
import userInfo from '../components/userManage/index.js';
import EditPasswd from '../components/userManage/editForm.js';
import MainApp from '../containers/Main.js';
import UserManage from '../containers/Users/index.js';

export default function router(history) {
  return (
    <Router history={history}>
      <Route path="/login" component={Login} />
      <Route path="/" component={MainApp} >
        <IndexRoute component={TestPackage} />
        <Route path="/testPackage/new" component={FormTestPackage} />
        <Route path="/testPackage/edit/:id" component={FormTestPackage} />
        <Route path="/testCategory" component={TestCategory} />
        <Route path="/testCategory/childrenDevice/:id" component={ChildrenDevice} />
        <Route path="/testCategory/pushCategory/:id" component={PushCategory} />
        <Route path="/testCategory/testResult" component={TestResult} />
        <Route path="/official/channel" component={OfficialChannel} />
        <Route path="/official/channel/new" component={FormChannel} />
        <Route path="/official/channel/edit/:id" component={FormChannel} />
        <Route path="/official/channel/push/:id" component={PushChannel} />
        <Route path="/official/package" component={OfficialPackage} />
        <Route path="/operate/pushlog" component={PushLog} />
        <Route path="/operate/channellog" component={ChannelLog} />
        <Route path="/operate/otherlog" component={OtherLog} />
        <Route path="/userManage" component={UserManage} />
        <Route path="/userManage/userInfo" component={userInfo} />
        <Route path="/userManage/editPasswd" component={EditPasswd} />
        <Route path="*" component={TestPackage} />
      </Route>
    </Router>
  );
}
